<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'base.item.class.php');

class MemberStatusNotifyBase extends BaseItemBase {
	var $_id = 0;
	var $_item = array();
	
	//constructor
	function MemberStatusNotifyBase() {
		parent::BaseItemBase();
		
		$this->_table_owner_field = 'uid';
		$this->table = 'pp_m_students_status_notify';
		$this->prefix = 's_';
		
		$this->sort_fields = array('id-');
	}
	
	//methods
	function addNotify($data_array) {
		$d = array();
		foreach($data_array as $k => $v) {
			$d['_' . $k] = $v;
		}
		
		return $this->addItem($d);
	}
	
	//
	function formatItem($item) {
		if( isset($item['difference']) ) {
			$diff = unserialize(stripslashes($item['difference']));
			$diff_s = '';
			if( is_array($diff) ) {
				foreach($diff as $k => $v) {
					$diff_s .= $k . ': ' . $v['0'] . ' => ' . $v['1'] . "<br>";
				}
			}
			//
			$item['difference'] = $diff;
			$item['differences'] = $diff_s;
		}
		
		return $item;
	}
}
//
?>